1290 IF VAL(N$(I,S)) = > VAL(N$(J,S)) THEN R(I) = R(I) +1
1300 NEXT J: NEXT I
1310 PRINT "SORTING ";
1320 FOR I = NR TO 1 STEP -1: FOR J = NR TO 1 STEP -1
1330 IF I < >J THEN IF R(I) = R(J) THEN R(J) = R(J) -1
1340 NEXT J: NEXT I
1350 PRINT "SORTING "
1360 J = 1
1370 IF R(J) = J THEN J = J +1: GOTO 1370
1380 IF J > = NR THEN 1420
1390 FOR I = 1 TO NH:Z$(I) = N$(R(J),I):N$(R(J),I) = N$(J,I):N$(J,I) = Z$(I): NEXT I
1400 Z = R(R(J)):R(R(J)) = R(J):R(J) = Z
1410 GOTO 1370
1420 PRINT "<CTRL-G>": PRINT "WANT TO SAVE THE "DB$" FILE": PRINT "SORTED BY "H$(S)" TO DISK ";: INPUT "Y/N) ?";L$: IF L$ = "Y" THEN F$ = "INDEX": GOSUB 4280
1430 GOTO 4810
1440 MF = 1: GOSUB 3880
1450 INPUT "ENTER # OF FIELD FOR SORT ";S$:S = VAL(S$): IF S <1 OR S >NH THEN 1450
1460 PRINT : PRINT "DO YOU WANT TO SORT:": PRINT
1470 PRINT "1 ALPHABETICALLY"
1480 PRINT "2 NUMERICALLY"
1490 PRINT
1500 INPUT "WHICH ";L$:L = VAL(L$)
1510 PRINT : PRINT "SORTING ";: GOTO 1240
1520 CALL 1013: REM *** CREATE HEADERFILE ***
1530 NR = 1
1540 HOME : PRINT "PRESS 'RETURN' TO EXIT TO MENU"
1550 PRINT
1560 PRINT "HEADER FOR COLUMN NUMBER "NR": ";: INPUT "";R$(NR)
1570 IF R$(NR) = "" OR NR >20 THEN 1600
1580 NR = NR +1
1590 GOTO 1560
1600 NR = NR -1
1610 GOSUB 4280: GOTO 1160
1620 REM ***ENTER RECORDS***
1630 HOME
1640 PRINT "THERE ARE "NR" RECORDS"
1650 PRINT "IN THE "DB$" FILE"
1660 NR = NR +1
1670 PRINT "YOU ARE ENTERING RECORD # "NR
1680 PRINT
1690 FOR I = 1 TO NH
1700 PRINT H$(I)":";: GOSUB 4720:N$(NR,I) = I$
1710 NEXT I
1720 PRINT
1730 INPUT "MORE (Y/N) ";L$
1740 IF L$ = "Y" THEN 1640
1750 F$ = "INDEX"
1760 GOSUB 4280
1770 GOTO 4810
1780 REM ***SEARCH/CHANGE***
1790 L = 0
1800 HOME
1810 PRINT "YOU MAY SEARCH BY ANY OF THE FOLLOWING:"
1820 PRINT
1830 GOSUB 3880
1840 PRINT : PRINT "OR YOU MAY": PRINT
1850 PRINT I" MAKE CHANGES"
1860 PRINT
1870 INPUT "WHICH ";S$:S = VAL(S$)
1880 IF S <0 OR S >NH +1 THEN 1870
1890 IF S = NH +1 THEN 2080
1900 HOME
1910 PRINT "PLEASE ENTER THE "H$(S): PRINT "YOU WANT TO FIND.......<CTRL-J>": INPUT "";Q$
1920 HOME
1930 FOR J = 1 TO NR
1940 N$(J,0) = STR$(J)
1950 IF LEFT$(N$(J,S), LEN(Q$)) = Q$ THEN GOSUB 2240
1960 IF L +NH >20 THEN GOSUB 2060
1970 NEXT J
1980 PRINT "THAT'S ALL OF THEM. ";
1990 PRINT "NOW YOU MAY:"
2000 PRINT "1 DO MORE SEARCHES"
2010 PRINT "2 MAKE CHANGES"
2020 PRINT "3 RETURN TO THE MAIN MENU"
2030 INPUT "<CTRL-J>WHICH ";S$:S = VAL(S$)
2040 IF S <1 OR S >3 THEN 2030
2050 ON S GOTO 1800,2080,4810
2060 IF PF < >0 THEN 2070
2062 PRINT "PRESS RETURN TO CONTINUE, ESC FOR MENU";
2064 GET L$
2065 IF ASC(L$) = 27 THEN 4810
2066 IF ASC(L$) < >13 THEN 2064
2070 L = 0: HOME : RETURN
2080 REM ***CHANGE DATA***
2090 PRINT "<CTRL-J>ENTER THE NUMBER OF THE RECORD"
2100 INPUT "YOU WANT TO CHANGE ";J$:J = VAL(J$)
2110 HOME : GOSUB 2240
2120 PRINT "<CTRL-J>ENTER THE NUMBER OF THE FIELD YOU WANT": PRINT "TO CHANGE ";
2130 INPUT "";S$:S = VAL(S$)
2140 IF S <1 OR S >NH THEN 2130
2150 PRINT
2160 PRINT "FROM "H$(S)": "N$(J,S)
2170 PRINT
2180 PRINT "TO "H$(S)": ";: INPUT "";N$(J,S)
2190 HOME : GOSUB 2240
2200 PRINT
2210 INPUT "<CTRL-J>MORE CHANGES (Y/N) ";L$
2220 IF L$ = "Y" THEN 2080
2230 F$ = "INDEX": GOSUB 4280: GOTO 4810
2240 REM ***PRINT A RECORD***
2250 ON PF GOSUB 5230,5250
2260 PRINT " "H$(0)": ";J
2270 FOR I = 1 TO NH
2280 PRINT I" "H$(I)": "N$(J,I)
2290 NEXT I
2300 PRINT
2310 L = L +NH +2
2320 PRINT D$"PR#0"
2330 RETURN
2340 REM ***DELETE RECORDS***
2350 HOME
2360 INPUT "ENTER RECORD NUMBER YOU WANT DELETED ";DR$:DR = VAL(DR$)
2370 IF DR <1 OR DR >NR THEN 2360
2380 FOR J = DR TO NR -1
2390 FOR I = 1 TO NH
2400 N$(J,I) = N$(J +1,I)
2410 NEXT I
2420 NEXT J
2430 PRINT : PRINT "RECORD NUMBER "DR" DELETED!": PRINT
2440 INPUT "MORE (Y/N) ";L$
2450 IF L$ = "Y" THEN 2360
2460 NR = NR -1:F$ = "INDEX": GOSUB 4280: GOTO 4810
2470 REM *** BASENAMEFILE ROUTINES ***
2480 HOME
2490 PRINT "SELECT FROM:": PRINT
2500 FOR J = 1 TO NR: PRINT J" "R$(J): NEXT J: PRINT
2510 PRINT J" CREATE A NEW DATA BASE"
2520 IF J >1 THEN PRINT J +1" DELETE A DATA BASE"
2530 PRINT
2540 INPUT "WHICH ";S$:S = VAL(S$)
2550 IF S = J +1 THEN 2660
2560 IF S <1 OR S >J THEN PRINT CHR$(7);: VTAB PEEK(37): CALL -868: GOTO 2540
2570 DB$ = R$(S)
2580 IF S < >J THEN 1140
2590 PRINT
2600 GOTO 2620
2610 CALL 1013
2620 IF J = 0 THEN J = 1
2630 INPUT "NAME FOR NEW DATA BASE FILE :";R$(J)
2640 NR = J: GOSUB 4280
2650 DB$ = R$(J -1): GOTO 1140
2660 REM *** DELETE A DATA BASE ***
2670 PRINT : INPUT "DELETE WHICH : ";S$:S = VAL(S$)
2680 IF S <1 OR S >J -1 THEN PRINT CHR$(7);: VTAB PEEK(37) -1: CALL -868: GOTO 2670
2690 HOME : VTAB (9): PRINT "READY TO DELETE " CHR$(34);R$(S); CHR$(34);".": PRINT
2700 PRINT "ONCE DELETED, THIS DATA CANNOT BE"
2710 PRINT "RECOVERED. ARE YOU SURE THAT YOU"
2720 PRINT "WANT TO DELETE IT? (Y/N) ";: INPUT "";S$
2730 IF S$ < >"Y" THEN 2470
2740 HOME : VTAB 12: HTAB 11: INVERSE : PRINT CHR$(91);" DELETING DATABASE ]": NORMAL